package smallDemend;
import java.util.Arrays;
import java.util.Scanner;

/**
 *
 *
 *某系统的数字密码(大于0)，比如1983，采用加密方式进行传输。
 * 规则如下:
 * 先得到每位数，然后每位数都加上5，再对10求余，最后将所有数字反转，得到一串新数.
 *
 *
 */
public class SecureDigital {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入数据：");
        int user = sc.nextInt();
        int use = user;
        int count = 1;
        //判断用户输入的数是几位数
        while (true) {
            user = user / 10;
            if (user > 0) {
                count++;
            } else {
                break;
            }
        }
        int[] arr = new int[count];
        System.out.println(count);
        //将每位数存入数组并反转
        for (int i = 0; i < count; i++) {
            arr[i] = use % 10;
            use = use / 10;
        }
        //每位数加5
        for (int i = 0; i < count; i++) {
            arr[i] = arr[i] + 5;
        }
        //每位数对10取余
        for (int i = 0; i < count; i++) {
            arr[i]=arr[i]%10;
        }
        /*for (int start = 0,end=arr.length; count > end; start++,end--) {
             int temp=arr[start];
             arr[start]=arr[end];
             arr[end]=temp;
        }*/
        System.out.println(Arrays.toString(arr));
    }
}
